import sys

import mvg.abstract_media

try:
   import mvg.terminal_media
   import mvg.terminal_media as active_media
except ImportError, msg:
   print msg

try:
   import mvg.mock_media
   import mvg.mock_media as active_media
except ImportError, msg:
   print msg

try:
   import mvg.tk_media
   import mvg.tk_media as active_media
except ImportError, msg:
   print msg

def media():
   try:
      if 'terminal' in sys.argv:
         return terminal_media
      elif 'tk' in sys.argv:
         return tk_media
      elif 'mock' in sys.argv:
         return mock_media
      elif 'abstract' in sys.argv:
         return abstract_media
      return active_media
   except NameError, msg:
      return abstract_media
